package cn.kgc.controller;

import cn.kgc.dto.Dto;
import cn.kgc.dto.DtoUtil;
import cn.kgc.service.HomeService;
import cn.kgc.vo.HotItemVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api")
public class HomeController {

    @Autowired
    HomeService homeService;


    /**
     * 查询首页轮播图
     * @return
     */
    @RequestMapping("/p/index/queryBanner")
    public Dto<List<HotItemVo>> queryBanner() throws Exception {
        //获取数据
        List<HotItemVo> hotItemVoDto=  homeService.queryBanner();
        //返回
        return DtoUtil.returnDataSuccess(hotItemVoDto);
    }

}
